Version 7/140425 of Basic Screen Effects by Emily Short begins here. "Waiting for a keypress; clearing the screen. Also provides facilities for changing the foreground and background colors of text, when using the z-machine. These abilities will not function under Glulx." Use authorial modesty. Section - Clearing the screen To clear the/-- screen: (- VM_ClearScreen(0); -). To clear only the/-- main screen: (- VM_ClearScreen(2); -). To clear only the/-- status line: (- VM_ClearScreen(1); -). Section - Waiting for key-presses, quitting suddenly Include (- ! Wait for a safe non navigating key. The user might press Down/PgDn or use the mouse scroll wheel to scroll a page of text, so we will stop those key codes from continuing. [ KeyPause key; while ( 1 ) { key = VM_KeyChar(); #Ifdef TARGET_ZCODE; if ( key == 63 or 129 or 130 or 132 ) { continue; } #Ifnot; ! TARGET_GLULX if ( key == -4 or -5 or -10 or -11 or -12 or -13 ) { continue; } #Endif; ! TARGET_ rfalse; } ]; [ SPACEPause i; while (i ~= 13 or 31 or 32) { i = VM_KeyChar(); } ]; ! No longer used but included just in case [ GetKey; return VM_KeyChar(); ]; -). [ Note that this no longer waits for *any* key, but only safe keys. The user might press Down/PgDn or use the mouse scroll wheel to scroll a page of text, so we will stop those key codes from continuing. ] To wait for any key: (- KeyPause(); -). To wait for the/-- SPACE key: (- SPACEPause(); -). Pausing the game is an activity. To pause the/-- game: carry out the pausing the game activity. For pausing the game (this is the standard pausing the game rule): say "[paragraph break]Please press SPACE to continue." (A); wait for the SPACE key; clear the screen. To stop the/-- game abruptly: (- quit; -). To decide what number is the chosen letter: (- VM_KeyChar() -). Section - Showing the current quotation To show the/-- current quotation: (- ClearBoxedText(); -); Section - Centering text on-screen To center (quote - text): (- CenterPrintComplex({quote}); -). To center (quote - text) at the/-- row (depth - a number): (- CenterPrint({quote}, {depth}); -). Include (- [ CenterPrint str depth i j len; font off; i = VM_ScreenWidth(); len = TEXT_TY_CharacterLength(str); if (len > 63) len = 63; j = (i-len)/2 - 1; VM_MoveCursorInStatusLine(depth, j); print (I7_string) str; font on; ]; [ CenterPrintComplex str i j len; font off; print "^"; i = VM_ScreenWidth(); len = TEXT_TY_CharacterLength(str); if (len > 63) len = 63; j = (i-len)/2 - 1; spaces j; print (I7_string) str; font on; ]; -). To decide what number is screen width: (- VM_ScreenWidth() -). To decide what number is screen height: (- I7ScreenHeight() -). Include (- [ I7ScreenHeight i screen_height; i = 0->32; if (screen_height == 0 or 255) screen_height = 18; screen_height = screen_height - 7; return screen_height; ]; -). Section - Customizing the status line To deepen the/-- status line to (depth - a number) rows: (- DeepStatus({depth}); -). To move the/-- cursor to (depth - a number): (- I7VM_MoveCursorInStatusLine({depth}); -). To right align the/-- cursor to (depth - a number): (- RightAlign({depth}); -). Include (- [ DeepStatus depth i screen_width; VM_StatusLineHeight(depth); screen_width = VM_ScreenWidth(); #ifdef TARGET_GLULX; VM_ClearScreen(1); #ifnot; style reverse; for (i=1:i